package com.dsy.xiangcun_manage.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.dsy.tools.entity.TbCounty;
import com.dsy.xiangcun_manage.service.ITbCountyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dsy
 * @since 2019-12-29
 */
@Controller
@RequestMapping("/county")
public class TbCountyController {

    @Autowired
    ITbCountyService tbCountyService;

    @RequestMapping("/getCountyById")
    @ResponseBody
    public List<TbCounty> getCountyById(Integer cityId){
        QueryWrapper<TbCounty> wrapper = new QueryWrapper<>();
        wrapper.eq("city_id",cityId);
        List<TbCounty> tbCounties = tbCountyService.list(wrapper);
        return tbCounties;
    }

}
